Next | Prev | Up | Top | Contents | Index
Using scsi_info()
Before a SCSI driver tries to access a device, it must call the host adapter scsi_info() function. This function issues an Inquiry command to the specified adapter, target, and logical unit. If the Inquiry is not successful--or if the adapter, target, or LUN is invalid--the return value is NULL. Otherwise, the return value is a pointer to a scsi_target_info structure.
The SCSI driver can learn the following things from a call to scsi_info():
- If the return is NULL, there is a serious problem with the device or the information about it. Write a descriptive log message with cmn_err() and return ENODEV.
- The si_inq field points to the Inquiry bytes returned by the device. Examine them for device-dependent information.
- Note the value in si_maxq for the largest number of pending SCSI commands that can be queued to this host adapter driver.
- Test the bits in si_ha_status for information about the capabilities and error status of the host adapter itself. The possible bits are declared in sys/scsi.h. For example, SRH_NOADAPSYNC indicates that the specified target, or possibly the host adapter itself, does not support synchronous transfer. Not all bits are supported by all host adapter drivers.
You can also call scsi_info() at other times; some of the returned information can be useful in error recovery. However, be aware that scsi_info() for some host adapters is slow, and can use serialized access to hardware.
Next | Prev | Up | Top | Contents | Index